package example

import "code.google.com/p/go-glue/rlglue"

func RunExperiment(host string, port int) (err error) {
	ex := new(rlglue.Experiment)
	if err = ex.Connect(host, port); err != nil {
		return
	}
	if _, err = ex.Init(); err != nil {
		return
	}
	if _, err = ex.Episode(10); err != nil {
		return
	}
	if err = ex.Cleanup(); err != nil {
		return
	}
	err = ex.Close()
	return
}
